package com.tongfusoft.document.web.controller.menu;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.tongfusoft.document.menu.service.IDocumentMenuService;
import com.tongfusoft.spring.web.core.controller.BaseController;
import com.tongfusoft.spring.web.core.controller.annotation.UrlDesc;
import com.tongfusoft.spring.web.core.data.ResultModel;


@Controller
public class MenuController extends BaseController{
	
	@Autowired
	@Qualifier("documentMenuService")
	public IDocumentMenuService menuService;
	
	@UrlDesc(value="菜单列表")
	@RequestMapping("/menu/list")
	@ResponseBody
	public ResultModel menu(Model model){
		ResultModel rm = new ResultModel<List>();
		
		rm.setState("success");
		try{
//			rm.setData(this.menuService.getMenuList());
			rm.setData(this.menuService.getMenuListByUser(super.getUser()));
			
		}catch(Exception e){
			
			e.printStackTrace();
			rm.setState("error");
		}
		return rm;
	}
}
